package com.jzr.bedside.db1.service.Impl;

import com.jzr.bedside.db1.mapper.DoorSideMapper;
import com.jzr.bedside.db1.service.DoorSideService;
import com.jzr.bedside.db1.vo.BedPatientVo;
import com.jzr.bedside.db1.vo.DoorSideVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DoorSideServiceImpl implements DoorSideService {
    @Autowired
    private DoorSideMapper doorSideMapper;

    @Override
    public DoorSideVo getDoorSideInfo(String deptCode, String roomCode) {
        DoorSideVo doorSideVo = doorSideMapper.getDoorSideInfo(deptCode,roomCode);
        if(doorSideVo == null) {return null;}

        List<BedPatientVo> list = doorSideMapper.getBedPatient(deptCode,roomCode);
        doorSideVo.setBeds(list);

        return doorSideVo;
    }
}
